package objects

import (
	"net/http"
	"strings"
	"os"
	"ones-objects/config"
	"io"
)

func put(w http.ResponseWriter, r *http.Request)  {
	path := r.URL.EscapedPath()

	fileName := strings.Split(path, "/")[2]

	content,err := storeObject(r.Body, fileName)
	if err != nil {

	}

	w.WriteHeader(content)

	/**
	f, err := os.Create(config.GetString(STORGE_ROOT_KEY) + STORGE_OBJECTS + fileName)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		w.Write([]byte(ERROR_OPEN_FILE))
		return
	}
	defer f.Close()
	io.Copy(f, r.Body)
	*/

}
